package leetcode_go

func twoSum(nums []int, target int) []int {
	targetMap := make(map[int]int)

	for i := 0; i < len(nums); i++ {
		partner := target - nums[i]
		if _, ok := targetMap[partner]; ok {
			return []int{targetMap[partner], i}
		}
		targetMap[nums[i]] = i
	}

	return nil
}
